import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberVO, MemberForm, MemberQuery } from '@/api/primary/member/types';

/**
 * 查询会员信息列表
 * @param query
 * @returns {*}
 */

export const listMember = (query ?: MemberQuery) : AxiosPromise<MemberVO[]> => {
  return request({
    url: '/primary/member/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员信息详细
 * @param id
 */
export const getMember = (id : string | number) : AxiosPromise<MemberVO> => {
  return request({
    url: '/primary/member/' + id,
    method: 'get'
  });
};
export const getcoachcard = (id : string | number) => {
  return request({
    url: '/primary/privateTeachingSchedule/getCardList/' + id,
    method: 'get'
  });
};
/**
 * 新增正式会员信息
 * @param data
 */
export const addMember = (data : MemberForm) => {
  return request({
    url: '/primary/member/regular',
    method: 'post',
    data: data
  });
};
/**
 * 新增准会员信息
 * @param data
 */
export const addMembertwo = (data : MemberForm) => {
  return request({
    url: '/primary/member',
    method: 'post',
    data: data
  });
};
/**
 * 修改会员信息
 * @param data
 */
export const updateMember = (data : MemberForm) => {
  return request({
    url: '/primary/member',
    method: 'put',
    data: data
  });
};
/**
 * 开卡与停卡
 * @param data
 */
export const updateStop = (data : MemberForm) => {
  return request({
    url: '/primary/member/openCard',
    method: 'put',
    data: data
  });
};
/**
 * 重新下发
 * @param data
 */
export const updateRePush = (data : MemberForm) => {
  return request({
    url: '/primary/member/rePush',
    method: 'put',
    data: data
  });
};
/**
 * 删除会员信息
 * @param id
 */
export const delMember = (id : string | number | Array<string | number>) => {
  return request({
    url: '/primary/member/' + id,
    method: 'delete'
  });
};
/**
 * 导出会员模版信息
 * @param id
 */
export const daochu = (id : string | number | Array<string | number>) => {
  return request({
    url: '/primary/member/aiUser/export',
    method: 'get'
  });
};
/**
 * 导入会员模版信息
 * @param id
 */
export const daoru = (id : string | number | Array<string | number>) => {
  return request({
    url: '/primary/member/upload',
    method: 'post'
  });
};
